package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class OOSDemo {
    public static void main(String[] args) throws IOException {
        String name = "坤坤";
        int age = 25;
        String gender = "男";
        String[] otherInfo = {"是一名练习时长两年半的偶像练习生","浙江绍兴","喜欢唱跳","rap","篮球"};
        Student kk = new Student(name,age,gender,otherInfo);
        System.out.println(kk);

        //对象输出流在序列化对象时，必须保证序列化对象必须实现Serializable接口
        FileOutputStream fos = new FileOutputStream("student.obj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(kk);
        System.out.println("写出完毕");
        oos.close();
    }
}
